﻿namespace Api.Controllers
{
    /// <summary>
    /// 在用绳档案
    /// </summary>
    public class UsingWireropeController : EditingBaseController<UsingWireropeModel, UsingWireropeFilterModel, IUsingWireropeLogic>
    {
        public UsingWireropeController(ICurrentUser currentUser, IUsingWireropeLogic logic)
            : base(currentUser, logic)
        {
        }

        #region 状态监测列表
        [HttpPost]
        public async Task<PageModel<UsingWireropeModel>> GetStatusMonitorPage([FromBody] UsingWireropeFilterModel filterModel, int pageIndex = 1, int pageSize = Gx._PAGE_SIZE, string orderBy = null)
        {
            filterModel._Status = (int)UsingWirerope_Status.在用;
            return await Task.Run(() => _logic.GetStatusMonitorPage(filterModel, pageIndex, pageSize, orderBy));
        }
        #endregion

        #region 状态监测详情
        [HttpGet]
        [Route("{id}")]
        public async Task<UsingWireropeModel> GetStatusMonitorByID(int id)
        {
            return await Task.Run(() => _logic.GetStatusMonitorByID(id));
        }
        #endregion

        #region 状态监测历史记录
        [HttpGet]
        [Route("{id}")]
        public async Task<UsingWireropeModel> GetStatusMonitoryHistoryByID(int id)
        {
            return await Task.Run(() => _logic.GetStatusMonitoryHistoryByID(id));
        }
        #endregion

        #region 首页
        [HttpPost]
        public async Task<HomeSummaryModel> GetHomeData([FromBody] UsingWireropeFilterModel filterModel)
        {
            return await Task.Run(() => _logic.GetHomeData(filterModel));
        }
        #endregion

        #region 导出
        [HttpGet]
        [Route("{id}")]
        public async Task<string> ExportLastCheckExcel(int id)
        {
            return await Task.Run(() => _logic.ExportLastCheckExcel(id));
        }
        #endregion

        #region 作废管理更新附件信息
        [HttpPost]
        public async Task UpdateZuoFeiInfo([FromBody] UsingWireropeModel model)
        {
            await Task.Run(() => _logic.UpdateZuoFeiInfo(model));
        }
        #endregion
    }
}
